<%
var title= isEmpty(item.id)?"新增":"编辑";
layout("/common/layout.html",{"title":title+"办件事项"}){
%>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-8">
        <h2>${title}服务事项</h2>
        <ol class="breadcrumb">
            <li><a href="${ctxPath}/admin/main">主页</a></li>
            <li><a href="${ctxPath}/windowOfficesItem/view/index">服务事项管理</a></li>
            <li class="active">${title}</li>
        </ol>
    </div>
    <div class="col-sm-4">
        <div class="title-action">
            <div class="btn-group">
                <a class="btn btn-primary btn-outline" href="${ctxPath}/windowOfficesItem/view/index"><i class="fa fa-reply"> </i> 返回列表</a>
                <%
                if(isNotEmpty(item.id)){
                %>
                <a class="btn btn-primary btn-outline" href="${ctxPath}/windowOfficesItem/view/${item.id!}/filesList"><i class="fa fa-file"> </i> 事项资料列表</a>
                <%
                }
                %>
            </div>
        </div>
    </div>
</div>
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins animated fadeInDown">
        <div class="ibox-content" id="step-box">

            <div class="panel panel-default">
                <div class="panel-heading">
                    <b class="text step-title">办件事项</b>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal" name="itemForm" id="itemForm" role="form">
                        <input value="${item.id!}" name="id" type="hidden">

                        <div class="form-group">
                            <label class="col-sm-1 control-label">主项名称：</label>
                            <div class="col-sm-8">
                                <input name="title" class="form-control" type="text" value="${item.title!}" placeholder="请输入主项名称，例如：公司章程备案" aria-required="true" required="required">
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">子项名称：</label>
                            <div class="col-sm-8">
                                <input name="subTitle" class="form-control" type="text" value="${item.subTitle!}" placeholder="请输入子项名称，例如：公司章程备案" aria-required="true" required="required">
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">基本编码：</label>
                            <div class="col-sm-5">
                                <input name="basicCode" class="form-control" type="text" value="${item.basicCode!}" placeholder="请输入基本编码，例如：QT65843001" aria-required="true">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">所属部门：</label>
                            <div class="col-sm-5">
                                <select class="form-control mainId" id="mainId" name="mainId" required="required"></select>
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>


                        <div class="form-group">
                            <label class="col-sm-1 control-label">审批主体：</label>
                            <div class="col-sm-5">
                                <input name="approvalUnit" class="form-control" type="text" value="${item.approvalUnit!}" placeholder="请输入审批主体，例如：洛龙区民政局审核科" aria-required="true" required="required">
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>


                        <div class="form-group">
                            <label class="col-sm-1 control-label">法定时限：</label>
                            <div class="col-sm-5">
                                <div class="input-group">
                                    <input name="legalTerm" class="form-control" type="number" value="${item.legalTerm!}" placeholder="请输入法定时限" aria-required="true" required="required">
                                    <span class="input-group-addon">工作日</span>
                                </div>
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">承诺时限：</label>
                            <div class="col-sm-5">
                                <div class="input-group">
                                    <input name="promiseTerm" class="form-control" type="number" value="${item.promiseTerm}" placeholder="请输入承诺时限" aria-required="true" required="required">
                                    <span class="input-group-addon">工作日</span>
                                </div>
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">办公地址：</label>
                            <div class="col-sm-5">
                                <textarea name="address" class="form-control" rows="3" placeholder="请输入办公地址" aria-required="true" required="required">${item.address!}</textarea>
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">联系电话：</label>
                            <div class="col-sm-5">
                                <input name="phone" class="form-control" type="text" value="${item.phone!}" placeholder="请输入联系电话，建议最多输入2个号码。" aria-required="true" required="required">
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">工作时间：</label>
                            <div class="col-sm-5">
                                <input id="officeTime" name="officeTime" class="form-control" type="text" value="${item.officeTime!}" placeholder="请输入办公时间" aria-required="true" required="required">
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>


                        <div class="form-group">
                            <label for="cost" class="col-sm-1 control-label">实施依据：</label>
                            <div class="col-sm-5">
                                <textarea id="basis" class="form-control" placeholder="请输入实施依据，例如：《社会保险法》" name="basis" rows="3" required="required">${item.basis!}</textarea>
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>

                        <!--<div class="form-group">-->
                            <!--<label for="cost" class="col-sm-1 control-label">收费信息：</label>-->
                            <!--<div class="col-sm-5">-->
                                <!--<textarea id="cost" class="form-control" placeholder="请输入收费信息，例如：工本费10元、无费用、免费" name="cost" rows="3" required="required">${item.cost!}</textarea>-->
                            <!--</div>-->
                            <!--<strong class="text-danger">*必填</strong>-->
                        <!--</div>-->

                        <div class="form-group">
                            <label for="cost" class="col-sm-1 control-label">收费信息：</label>
                            <div class="col-sm-5">
                                <textarea id="cost" name="cost" hidden="hidden" >${item.cost!}</textarea>
                                <div id="costEditer" data-placeholder="请输入收费信息，例如：工本费10元、无费用、免费">
                                    <p>${item.cost!}</p>
                                </div>
                            </div>
                            <strong class="text-danger">*必填</strong>
                        </div>


                        <div class="form-group">
                            <label class="col-sm-1 control-label">事项排序：</label>
                            <div class="col-sm-5">
                                <input name="sort" class="form-control" type="number" value="${item.sort!0}" min="0" placeholder="请输入事项顺序，默认0即可。" aria-required="true" required="required">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">流程图：</label>
                            <div class="col-sm-5" id="picture">
                                <input id="pictureUploader" name="files" class="form-control" type="file" data-min-file-count="1" data-msg-placeholder="请上传流程图，可上传1张。">
                            </div>
                        </div>

                        <div class="form-group">
                            <strong id="error-message"></strong>
                            <div class="col-sm-offset-1 col-sm-5 img-responsive" id="flowShow">
                                <input name="flowChart" id="flowChart" class="form-control" type="text" value="${item.flowChart!}" placeholder="流程图文件" readonly="readonly" required="required">
                                <hr>
                                <%
                                var nopic = '/'+uploaderImageNotpic;
                                %>
                                <img src="${item.flowChart!nopic}" class="img-thumbnail">
                            </div>
                            <strong class="text-danger">*必传</strong>
                        </div>

                        <div class="form-group">
                            <label for="cost" class="col-sm-1 control-label">部门分工：</label>
                            <div class="col-sm-11">
                                <table class="table table-bordered" id="depStepList">
                                    <thead>
                                    <tr>
                                        <th width="10%">办理环节</th>
                                        <th width="45%">责任事项</th>
                                        <th width="15%">责任处室</th>
                                        <th width="10%">承诺时限</th>
                                        <th width="10%">法定时限</th>
                                        <th width="10%">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <%
                                    if(isNotEmpty(stepsList)){
                                    %>
                                    <%
                                    for(steps in stepsList){
                                    %>
                                    <tr>
                                        <td><textarea rows="3" class="form-control" name="depStepList[${stepsLP.index}].steps" placeholder="例如：受理">${steps.steps!}</textarea></td>
                                        <td><textarea rows="3" class="form-control" name="depStepList[${stepsLP.index}].item" placeholder="例如：按照《社会保障法》第八条进行审查">${steps.item!}</textarea></td>
                                        <td><textarea rows="3" class="form-control" name="depStepList[${stepsLP.index}].office" placeholder="例如：受理科">${steps.office!}</textarea></td>
                                        <td><textarea rows="3" class="form-control" name="depStepList[${stepsLP.index}].promiseTerm" placeholder="例如：当场办理">${steps.promiseTerm!}</textarea></td>
                                        <td><textarea rows="3" class="form-control" name="depStepList[${stepsLP.index}].legalTerm" placeholder="例如：2天">${steps.legalTerm!}</textarea></td>
                                        <td><button class="btn btn-danger btn-outline center-block" onclick="$(this).parents('tr').remove()">删除</button></td>
                                    </tr>
                                    <%
                                    }
                                    %>
                                    <%
                                    }
                                    %>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="6">
                                            <button class="btn btn-success btn-outline btn-lg text-center center-block" id="addDepSteps" type="button"><i class="fa fa-plus-circle"></i>&emsp;添加分工步骤（必填）</button>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>


                    </form>
                </div>

                <div class="panel-footer">
                    <div class="col-sm-offset-3 clearfix">
                        <div class="mt5 mb5 block col-sm-3">
                            <a href="index" class="btn btn-white btn-block"><i class="fa fa-times"></i>&ensp;取消</a>
                        </div>
                        <div class="mt5 mb5 block col-sm-3">
                            <button id="doSubmit" data-exist-next="true" class="btn btn-primary btn-block"><i class="fa fa-check"></i>&ensp;下一步</button>
                        </div>
                    </div>
                </div>

            </div>

        </div>

    </div>

</div>
<% } %>
<script type="text/javascript">
    //页面JS调用
    require(['windowOffices/item'], function (item) {
        item.save("${item.cateId!}", "${item.mainId!}", "${item.officeTime!'9:00 - 17:00'}");
    });


</script>